package com.Servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.Bean.News;
import com.Bean.Page;

/**
 * Servlet implementation class jstlServlet
 */
@WebServlet("/jstlServlet")
public class jstlServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public jstlServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		      Page p=new Page();
		      p.setTotal(56);
		      p.setCurrentPage(2);
		      request.setAttribute("p", p);
		      
		      News news1=new  News();
		      news1.setxId(101);
		      news1.setTitle("郑州");
		      News news2=new  News();
		      news2.setxId(102);
		      news2.setTitle("苏州");
		      News news3=new  News();
		      news3.setxId(103);
		      news3.setTitle("杭州");
		      List<News> list=new ArrayList();
		      list.add(news1);
		      list.add(news2);
		      list.add(news3);
		      request.setAttribute("list", list);
		      request.getRequestDispatcher("jstl.jsp").forward(request, response);
		      
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
